package com.csw.shuanfa.CodeImprove.designPattern;



/**
 * 适配器模式-类适配器
 */
public class AdapterD2 {
    /**
     * @param args
     */
    public static void main(String[] args) {
        Shape2 shape2 = new ClassAdapter();
        shape2.draw();
    }
}

//目标接口
interface Shape2 {
    void draw();
}

//原始类
class Rectangle2 {
    void draw() {
        System.out.println("Rectangle draw()");
    }
}

//适配器类
class ClassAdapter extends Rectangle2 implements Shape2 {

    @Override
    public void draw() {
        super.draw();
    }
}
